import {Object3D} from "./Object3D";
import {IVector3} from "../math/types";
import {Matrix4} from "../math/Matrix4";
import {Vector3} from "../math/Vector3";

export class OrthographicCamera {

    left: number = -1;
    right: number = 1;
    top: number = 1;
    bottom: number  = -1;
    near: number = 0.1;
    far: number = 1000;

    position: Vector3 = new Vector3();
    lookTarget: Vector3 = new Vector3();
    upDire: Vector3 = new Vector3();

    lookAt(target: IVector3, upDire: IVector3) {
        this.lookTarget.loadData(target);
        this.upDire.loadData(upDire);
    }

    getViewMatrix() {
        return  new Matrix4().getInverse(new Matrix4().lookAt(this.position, this.lookTarget, this.upDire));
    }
    getProjectMatrix() {
        return new Matrix4().makeOrthographic(this.left, this.right, this.top, this.bottom, this.near, this.far);
    }
}